<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>Aria: twoRobotWander.cpp</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Aria
   &#160;<span id="projectnumber">2.9.4</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li><a href="examples.html"><span>Examples</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('twoRobotWander_8cpp-example.html','');});
</script>
<div id="doc-content">
<div class="header">
  <div class="headertitle">
<div class="title">twoRobotWander.cpp</div>  </div>
</div><!--header-->
<div class="contents">
<p>Example showing how one program can connect to two robots using TCP network connection via <a class="el" href="classArTcpConnection.html" title="For connecting to a device through a TCP network socket. ">ArTcpConnection</a> objects (in simulator or to Amigobot or Pioneer with wireless-serial bridge device).To use with MobileSim, expand "More Options" and create 2 robots, and select a map. Or run from the command line like this: MobileSim -r p3dx-sh -r p3dx-sh -map ../maps/columbia.map</p>
<p>Normally, a program will only connect to one robot, and will only have one <a class="el" href="classArRobot.html" title="Central class for communicating with and operating the robot. ">ArRobot</a> object. However, it is possible to connect to more than one robot from the same program &ndash; for example, this may be useful for doing multirobot experiments in a simulator, or to control remote robots with wireless-serial bridge devices from an offboard computer. This program demonstrates this by connecting to two robots over TCP connections. (Old systems with dedicated serial-radio links for each robot would require modifying this program to use serial connections instead.)</p>
<p>Specify the hostnames of each robot with -rh1 and -rh2 command line arguments (defaults are "localhost" for each). Specify port numbers for each with -rp1 and -rp2 command line arguments (defaults are 8101 for each if the hostnames are different, or 8101 and 8102 if the hostnames are the same).</p>
<p>This program will just have two robots wander around, avoiding obstacles detected by the sonar, or otherwise moving forward at constant velocity. First it has one robot wander for a period of time, then it has the second robot wander around.</p>
<div class="fragment"><div class="line"><span class="preprocessor">#include &quot;Aria.h&quot;</span></div><div class="line"></div><div class="line"><span class="keywordtype">int</span> main(<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span>** argv)</div><div class="line">{</div><div class="line"></div><div class="line">  <span class="comment">// initialize ARIA</span></div><div class="line">  <a name="a0"></a><a class="code" href="classAria.html#ad99c16b5d947229d9f8e1c5b2d4cdd73">Aria::init</a>();</div><div class="line"></div><div class="line">  <span class="comment">// used to parse command-line arguments. only one instance needed.</span></div><div class="line">  <a name="_a1"></a><a class="code" href="classArArgumentParser.html">ArArgumentParser</a> argParser(&amp;argc, argv);</div><div class="line"></div><div class="line">  <span class="comment">// get hostnames and port numbers for connecting to the robots.</span></div><div class="line">  <span class="keyword">const</span> <span class="keywordtype">char</span>* host1 = argParser.<a name="a2"></a><a class="code" href="classArArgumentParser.html#aca9661c6e8ef423337590bc5c2336dec">checkParameterArgument</a>(<span class="stringliteral">&quot;-rh1&quot;</span>);</div><div class="line">  <span class="keywordflow">if</span>(!host1) host1 = <span class="stringliteral">&quot;localhost&quot;</span>;</div><div class="line">  <span class="keyword">const</span> <span class="keywordtype">char</span>* host2 = argParser.<a class="code" href="classArArgumentParser.html#aca9661c6e8ef423337590bc5c2336dec">checkParameterArgument</a>(<span class="stringliteral">&quot;-rh2&quot;</span>);</div><div class="line">  <span class="keywordflow">if</span>(!host2) host2 = <span class="stringliteral">&quot;localhost&quot;</span>;</div><div class="line">  <span class="keywordtype">int</span> port1 = 8101;</div><div class="line">  <span class="keywordtype">int</span> port2 = 8101;</div><div class="line">  <span class="keywordflow">if</span>(strcmp(host1, host2) == 0 )</div><div class="line">  {</div><div class="line">    <span class="comment">// same host, it must be using two ports (but can still override below with -rp2)</span></div><div class="line">    port2++;</div><div class="line">  }</div><div class="line"></div><div class="line">  <span class="keywordtype">bool</span> argSet = <span class="keyword">false</span>;</div><div class="line">  argParser.<a name="a3"></a><a class="code" href="classArArgumentParser.html#a6cbddc515e1be6d901b1a0c846f19ef8">checkParameterArgumentInteger</a>(<span class="stringliteral">&quot;-rp1&quot;</span>, &amp;port1, &amp;argSet);  </div><div class="line">  <span class="keywordflow">if</span>(!argSet) argParser.<a class="code" href="classArArgumentParser.html#a6cbddc515e1be6d901b1a0c846f19ef8">checkParameterArgumentInteger</a>(<span class="stringliteral">&quot;-rrtp1&quot;</span>, &amp;port1);</div><div class="line">  argSet = <span class="keyword">false</span>;</div><div class="line">  argParser.<a class="code" href="classArArgumentParser.html#a6cbddc515e1be6d901b1a0c846f19ef8">checkParameterArgumentInteger</a>(<span class="stringliteral">&quot;-rp2&quot;</span>, &amp;port2, &amp;argSet);</div><div class="line">  <span class="keywordflow">if</span>(!argSet) argParser.<a class="code" href="classArArgumentParser.html#a6cbddc515e1be6d901b1a0c846f19ef8">checkParameterArgumentInteger</a>(<span class="stringliteral">&quot;-rrtp2&quot;</span>, &amp;port2);</div><div class="line">  </div><div class="line">  <span class="keywordflow">if</span>(!argParser.<a name="a4"></a><a class="code" href="classArArgumentParser.html#ac3889cbdfa862031c51bf80e06954914">checkHelpAndWarnUnparsed</a>())</div><div class="line">  {</div><div class="line">    <a name="a5"></a><a class="code" href="classArLog.html#a43a8b3789126c818f390f24bdbceccce">ArLog::log</a>(<a name="a6"></a><a class="code" href="classArLog.html#ac8cc0fb3aa323ab2a1c21340fdd1dce3a012daf6573594f91242f8dd7c02eb74b">ArLog::Terse</a>, <span class="stringliteral">&quot;Usage: twoRobotWander [-rh1 &lt;hostname1&gt;] [-rh2 &lt;hostname2&gt;] [-rp1 &lt;port1&gt;] [-rp2 &lt;port2&gt;]\n&quot;</span>\</div><div class="line">      <span class="stringliteral">&quot;\t&lt;hostname1&gt; Is the network host name of the first robot.&quot;</span>\</div><div class="line">          <span class="stringliteral">&quot; Default is localhost (for the simulator).\n&quot;</span>\</div><div class="line">      <span class="stringliteral">&quot;\t&lt;hostname2&gt; Is the network host name of the second robot.&quot;</span>\</div><div class="line">          <span class="stringliteral">&quot; Default is localhost (for the simulator).\n&quot;</span>\</div><div class="line">      <span class="stringliteral">&quot;\t&lt;port1&gt; Is the TCP port number of the first robot. Default is 8101.\n&quot;</span>\</div><div class="line">      <span class="stringliteral">&quot;\t&lt;port2&gt; Is the TCP port number of the second robot. Default is 8102 if&quot;</span>\</div><div class="line">        <span class="stringliteral">&quot; both robots have the same hostname, or 8101 if they differ.\n\n&quot;</span>);</div><div class="line">    <span class="keywordflow">return</span> 1;</div><div class="line">  }</div><div class="line"></div><div class="line">  </div><div class="line"></div><div class="line">  <span class="comment">//</span></div><div class="line">  <span class="comment">// The first robot&#39;s objects</span></div><div class="line">  <span class="comment">//</span></div><div class="line">  <span class="comment">// the first robot connection</span></div><div class="line">  <a name="_a7"></a><a class="code" href="classArTcpConnection.html">ArTcpConnection</a> con1;</div><div class="line">  <span class="comment">// the first robot interface</span></div><div class="line">  <a name="_a8"></a><a class="code" href="classArRobot.html">ArRobot</a> robot1;</div><div class="line">  <span class="comment">// sonar interface</span></div><div class="line">  <a name="_a9"></a><a class="code" href="classArSonarDevice.html">ArSonarDevice</a> sonar1;</div><div class="line">  <span class="comment">// the actions we&#39;ll use to cause wander behavior for the first robot</span></div><div class="line">  <a name="_a10"></a><a class="code" href="classArActionStallRecover.html">ArActionStallRecover</a> recover1;</div><div class="line">  <a name="_a11"></a><a class="code" href="classArActionBumpers.html">ArActionBumpers</a> bumpers1;</div><div class="line">  <a name="_a12"></a><a class="code" href="classArActionAvoidFront.html">ArActionAvoidFront</a> avoidFront1;</div><div class="line">  <a name="_a13"></a><a class="code" href="classArActionConstantVelocity.html">ArActionConstantVelocity</a> constantVelocity1(<span class="stringliteral">&quot;Constant Velocity&quot;</span>, 400);</div><div class="line"></div><div class="line">  <span class="comment">//</span></div><div class="line">  <span class="comment">// The second robot&#39;s objects</span></div><div class="line">  <span class="comment">//</span></div><div class="line">  <span class="comment">// the second robot connection</span></div><div class="line">  <a class="code" href="classArTcpConnection.html">ArTcpConnection</a> con2;</div><div class="line">  <span class="comment">// the second robot</span></div><div class="line">  <a class="code" href="classArRobot.html">ArRobot</a> robot2;</div><div class="line">  <span class="comment">// sonar</span></div><div class="line">  <a class="code" href="classArSonarDevice.html">ArSonarDevice</a> sonar2;</div><div class="line">  <span class="comment">// the actions we&#39;ll use to wander for the second robot</span></div><div class="line">  <a class="code" href="classArActionStallRecover.html">ArActionStallRecover</a> recover2;</div><div class="line">  <a class="code" href="classArActionBumpers.html">ArActionBumpers</a> bumpers2;</div><div class="line">  <a class="code" href="classArActionAvoidFront.html">ArActionAvoidFront</a> avoidFront2;</div><div class="line">  <a class="code" href="classArActionConstantVelocity.html">ArActionConstantVelocity</a> constantVelocity2(<span class="stringliteral">&quot;Constant Velocity&quot;</span>, 400);</div><div class="line"></div><div class="line"></div><div class="line">  <span class="comment">//</span></div><div class="line">  <span class="comment">// Lets get robot 1 going</span></div><div class="line">  <span class="comment">//</span></div><div class="line">  <span class="keywordtype">int</span> ret;</div><div class="line">  std::string str;</div><div class="line"></div><div class="line">  <span class="comment">// open the connection, if this fails exit</span></div><div class="line">  <a class="code" href="classArLog.html#a43a8b3789126c818f390f24bdbceccce">ArLog::log</a>(<a name="a14"></a><a class="code" href="classArLog.html#ac8cc0fb3aa323ab2a1c21340fdd1dce3a7040faf60eeb155eaa85d439b1066ca1">ArLog::Normal</a>, <span class="stringliteral">&quot;Connecting to first robot at %s:%d...&quot;</span>, host1, port1);</div><div class="line">  <span class="keywordflow">if</span> ((ret = con1.<a name="a15"></a><a class="code" href="classArTcpConnection.html#a9a745deeb1d377fbf615e91eba755bde">open</a>(host1, port1)) != 0)</div><div class="line">  {</div><div class="line">    str = con1.<a name="a16"></a>getOpenMessage(ret);</div><div class="line">    printf(<span class="stringliteral">&quot;Open failed to robot 1: %s\n&quot;</span>, str.c_str());</div><div class="line">    <a name="a17"></a><a class="code" href="classAria.html#a6abc3d39b3e9548063bb8e78375acc17">Aria::exit</a>(1);</div><div class="line">    <span class="keywordflow">return</span> 1;</div><div class="line">  }</div><div class="line">  </div><div class="line">  <span class="comment">// add the sonar to the robot</span></div><div class="line">  robot1.<a name="a18"></a><a class="code" href="classArRobot.html#a97d57b28549fdef851c00749a97cc776">addRangeDevice</a>(&amp;sonar1);</div><div class="line">  </div><div class="line">  <span class="comment">// set the device connection on the robot</span></div><div class="line">  robot1.<a name="a19"></a><a class="code" href="classArRobot.html#afdefce1c9f642dae8e68201ec509b898">setDeviceConnection</a>(&amp;con1);</div><div class="line">  </div><div class="line">  <span class="comment">// try to connect, if we fail exit</span></div><div class="line">  <span class="keywordflow">if</span> (!robot1.<a name="a20"></a><a class="code" href="classArRobot.html#abc322326500b02e3e6e0bcaf7bf88d5f">blockingConnect</a>())</div><div class="line">  {</div><div class="line">    printf(<span class="stringliteral">&quot;Could not connect to robot 1... exiting\n&quot;</span>);</div><div class="line">    <a class="code" href="classAria.html#a6abc3d39b3e9548063bb8e78375acc17">Aria::exit</a>(1);</div><div class="line">    <span class="keywordflow">return</span> 1;</div><div class="line">  }</div><div class="line"></div><div class="line">  <span class="comment">// turn on the motors, turn off amigobot sounds</span></div><div class="line">  robot1.<a name="a21"></a><a class="code" href="classArRobot.html#aceef80a6274fb34aafcc422e4b1778c1">comInt</a>(<a name="a22"></a><a class="code" href="classArCommands.html#a9a31f904a95bbc31d8b33c6637100cc4aa8d799cced5def80525936119963aad4">ArCommands::ENABLE</a>, 1);</div><div class="line">  robot1.<a class="code" href="classArRobot.html#aceef80a6274fb34aafcc422e4b1778c1">comInt</a>(<a name="a23"></a><a class="code" href="classArCommands.html#a9a31f904a95bbc31d8b33c6637100cc4a7a256695b7937192e88c976d2fd106e5">ArCommands::SOUNDTOG</a>, 0);</div><div class="line"></div><div class="line">  <span class="comment">// add the actions</span></div><div class="line">  robot1.<a name="a24"></a><a class="code" href="group__easy.html#ga9ab030786d423237d3e4aa06c0e9d8ce">addAction</a>(&amp;recover1, 100);</div><div class="line">  robot1.<a class="code" href="group__easy.html#ga9ab030786d423237d3e4aa06c0e9d8ce">addAction</a>(&amp;bumpers1, 75);</div><div class="line">  robot1.<a class="code" href="group__easy.html#ga9ab030786d423237d3e4aa06c0e9d8ce">addAction</a>(&amp;avoidFront1, 50);</div><div class="line">  robot1.<a class="code" href="group__easy.html#ga9ab030786d423237d3e4aa06c0e9d8ce">addAction</a>(&amp;constantVelocity1, 25);</div><div class="line"></div><div class="line"></div><div class="line">  <span class="comment">//</span></div><div class="line">  <span class="comment">// Lets get robot 2 going</span></div><div class="line">  <span class="comment">//</span></div><div class="line"></div><div class="line">  <span class="comment">// open the connection, if this fails exit</span></div><div class="line">  <a class="code" href="classArLog.html#a43a8b3789126c818f390f24bdbceccce">ArLog::log</a>(<a class="code" href="classArLog.html#ac8cc0fb3aa323ab2a1c21340fdd1dce3a7040faf60eeb155eaa85d439b1066ca1">ArLog::Normal</a>, <span class="stringliteral">&quot;Connecting to second robot at %s:%d...&quot;</span>, host2, port2);</div><div class="line">  <span class="keywordflow">if</span> ((ret = con2.<a class="code" href="classArTcpConnection.html#a9a745deeb1d377fbf615e91eba755bde">open</a>(host2, port2)) != 0)</div><div class="line">  {</div><div class="line">    str = con2.getOpenMessage(ret);</div><div class="line">    printf(<span class="stringliteral">&quot;Open failed to robot 2: %s\n&quot;</span>, str.c_str());</div><div class="line">    <a class="code" href="classAria.html#a6abc3d39b3e9548063bb8e78375acc17">Aria::exit</a>(1);</div><div class="line">    <span class="keywordflow">return</span> 1;</div><div class="line">  }</div><div class="line">  </div><div class="line">  <span class="comment">// add the sonar to the robot</span></div><div class="line">  robot2.<a class="code" href="classArRobot.html#a97d57b28549fdef851c00749a97cc776">addRangeDevice</a>(&amp;sonar2);</div><div class="line">  </div><div class="line">  <span class="comment">// set the device connection on the robot</span></div><div class="line">  robot2.<a class="code" href="classArRobot.html#afdefce1c9f642dae8e68201ec509b898">setDeviceConnection</a>(&amp;con2);</div><div class="line">  </div><div class="line">  <span class="comment">// try to connect, if we fail exit</span></div><div class="line">  <span class="keywordflow">if</span> (!robot2.<a class="code" href="classArRobot.html#abc322326500b02e3e6e0bcaf7bf88d5f">blockingConnect</a>())</div><div class="line">  {</div><div class="line">    printf(<span class="stringliteral">&quot;Could not connect to robot 2... exiting\n&quot;</span>);</div><div class="line">    <a class="code" href="classAria.html#a6abc3d39b3e9548063bb8e78375acc17">Aria::exit</a>(1);</div><div class="line">    <span class="keywordflow">return</span> 1;</div><div class="line">  }</div><div class="line"></div><div class="line">  <span class="comment">// turn on the motors, turn off amigobot sounds</span></div><div class="line">  robot2.<a class="code" href="classArRobot.html#aceef80a6274fb34aafcc422e4b1778c1">comInt</a>(<a class="code" href="classArCommands.html#a9a31f904a95bbc31d8b33c6637100cc4aa8d799cced5def80525936119963aad4">ArCommands::ENABLE</a>, 1);</div><div class="line">  robot2.<a class="code" href="classArRobot.html#aceef80a6274fb34aafcc422e4b1778c1">comInt</a>(<a class="code" href="classArCommands.html#a9a31f904a95bbc31d8b33c6637100cc4a7a256695b7937192e88c976d2fd106e5">ArCommands::SOUNDTOG</a>, 0);</div><div class="line"></div><div class="line">  <span class="comment">// add the actions</span></div><div class="line">  robot2.<a class="code" href="group__easy.html#ga9ab030786d423237d3e4aa06c0e9d8ce">addAction</a>(&amp;recover2, 100);</div><div class="line">  robot2.<a class="code" href="group__easy.html#ga9ab030786d423237d3e4aa06c0e9d8ce">addAction</a>(&amp;bumpers2, 75);</div><div class="line">  robot2.<a class="code" href="group__easy.html#ga9ab030786d423237d3e4aa06c0e9d8ce">addAction</a>(&amp;avoidFront2, 50);</div><div class="line">  robot2.<a class="code" href="group__easy.html#ga9ab030786d423237d3e4aa06c0e9d8ce">addAction</a>(&amp;constantVelocity2, 25);</div><div class="line">  </div><div class="line">  <span class="comment">// start the robots running. true so that if we lose connection to either</span></div><div class="line">  <span class="comment">// robot, the run stops.</span></div><div class="line">  robot1.<a name="a25"></a><a class="code" href="classArRobot.html#a3c3d878cfd11a2ef91230005a83bfcaa">runAsync</a>(<span class="keyword">true</span>);</div><div class="line">  robot2.<a class="code" href="classArRobot.html#a3c3d878cfd11a2ef91230005a83bfcaa">runAsync</a>(<span class="keyword">true</span>);</div><div class="line"></div><div class="line">  <span class="comment">// As long as both robot loops are running, lets alternate between the</span></div><div class="line">  <span class="comment">// two wandering around every 10 sec.  mutex lock/unlock calls are neccesary since </span></div><div class="line">  <span class="comment">// the ArRobot objects are running in background threads after runAsync()</span></div><div class="line">  <span class="comment">// calls above.</span></div><div class="line">  <span class="keywordtype">int</span> curRobot=1;</div><div class="line">  <span class="keywordflow">while</span> (robot1.<a name="a26"></a><a class="code" href="group__easy.html#ga808f67ab5b35165c2605b3002df4b499">isRunning</a>() &amp;&amp; robot2.<a class="code" href="group__easy.html#ga808f67ab5b35165c2605b3002df4b499">isRunning</a>())</div><div class="line">  {</div><div class="line">    <a name="a27"></a><a class="code" href="group__easy.html#ga4dfb878a3f9123b8dd96ae05b2fd94cb">ArUtil::sleep</a>(10000);</div><div class="line">    robot1.<a name="a28"></a><a class="code" href="classArRobot.html#a5aecc7ac998c9a31b82fdb904efa8609">lock</a>();</div><div class="line">    robot2.<a class="code" href="classArRobot.html#a5aecc7ac998c9a31b82fdb904efa8609">lock</a>();</div><div class="line">    <span class="keywordflow">if</span> (curRobot == 1)</div><div class="line">    {</div><div class="line">      <a class="code" href="classArLog.html#a43a8b3789126c818f390f24bdbceccce">ArLog::log</a>(<a class="code" href="classArLog.html#ac8cc0fb3aa323ab2a1c21340fdd1dce3a7040faf60eeb155eaa85d439b1066ca1">ArLog::Normal</a>, <span class="stringliteral">&quot;Switching to robot 2.&quot;</span>);</div><div class="line">      robot1.<a name="a29"></a><a class="code" href="group__easy.html#gac354fe63f9e58b33343f38923f1588fd">stop</a>();</div><div class="line">      robot2.<a name="a30"></a><a class="code" href="classArRobot.html#a5b1b947ef2e28d171f023b1bbe5d02a9">clearDirectMotion</a>();</div><div class="line">      curRobot=2;</div><div class="line">    }</div><div class="line">    <span class="keywordflow">else</span></div><div class="line">    {</div><div class="line">      <a class="code" href="classArLog.html#a43a8b3789126c818f390f24bdbceccce">ArLog::log</a>(<a class="code" href="classArLog.html#ac8cc0fb3aa323ab2a1c21340fdd1dce3a7040faf60eeb155eaa85d439b1066ca1">ArLog::Normal</a>, <span class="stringliteral">&quot;Switching to robot 1.&quot;</span>);</div><div class="line">      robot2.<a class="code" href="group__easy.html#gac354fe63f9e58b33343f38923f1588fd">stop</a>();</div><div class="line">      robot1.<a class="code" href="classArRobot.html#a5b1b947ef2e28d171f023b1bbe5d02a9">clearDirectMotion</a>();</div><div class="line">      curRobot=1;</div><div class="line">    }</div><div class="line">    robot2.<a name="a31"></a><a class="code" href="classArRobot.html#a403d9de010dc2b8d478cd0b14b2d9491">unlock</a>();</div><div class="line">    robot1.<a class="code" href="classArRobot.html#a403d9de010dc2b8d478cd0b14b2d9491">unlock</a>();</div><div class="line">  }</div><div class="line">  </div><div class="line">  </div><div class="line">  <span class="comment">// exit program if both robots disconnect.</span></div><div class="line">  <a class="code" href="classArLog.html#a43a8b3789126c818f390f24bdbceccce">ArLog::log</a>(<a class="code" href="classArLog.html#ac8cc0fb3aa323ab2a1c21340fdd1dce3a7040faf60eeb155eaa85d439b1066ca1">ArLog::Normal</a>, <span class="stringliteral">&quot;Both robots disconnected.&quot;</span>);</div><div class="line">  <a class="code" href="classAria.html#a6abc3d39b3e9548063bb8e78375acc17">Aria::exit</a>(0);</div><div class="line">  <span class="keywordflow">return</span> 0;</div><div class="line">}</div></div><!-- fragment --> </div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.11 </li>
  </ul>
</div>
</body>
</html>
